﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Security.Policy;

namespace Devtm.ServiceModel.Helpers
{
    
    public static class ConfigurationHelper
    {


        public static System.Configuration.Configuration GetConfiguration()
        {
            string conf = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
            return GetConfiguration(new System.IO.FileInfo(conf));
        }

        public static System.Configuration.Configuration GetConfiguration(System.IO.FileInfo file)
        {

            if (!file.Exists)
                throw new System.IO.FileNotFoundException(file.FullName);

            var conf = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(new System.Configuration.ExeConfigurationFileMap() { ExeConfigFilename = file.FullName }, System.Configuration.ConfigurationUserLevel.None);

            return conf;

        }

    }

   
}
